| Total Complexity | 1 |
| Total Lines | 10 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import {ConfigService} from '@nestjs/config'; |
||
| 2 | |||
| 3 | export class FileLocationStrategy { |
||
| 4 | constructor(private readonly configService: ConfigService) {} |
||
| 5 | |||
| 6 | public async location(fileName: string, uploadedDate: Date): Promise<string> { |
||
| 7 | const destination = await this.configService.get<string>('UPLOAD_LOCATION'); |
||
| 8 | const month = uploadedDate.getMonth() + 1; |
||
| 9 | const year = uploadedDate.getFullYear(); |
||
| 10 | |||
| 11 | return `${destination}/${year}/${month}/${fileName}`; |
||
| 12 | } |
||
| 14 |